package com.gitee.feizns.quickstart.mybatis.plus.jpa;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.fasterxml.jackson.annotation.JsonPropertyOrder;
import com.gitee.feizns.quickstart.ddl.annotation.Comment;
import lombok.Getter;
import lombok.Setter;
import lombok.ToString;
import lombok.experimental.Accessors;

import javax.persistence.Column;
import javax.persistence.Id;
import javax.persistence.MappedSuperclass;

/**
 * 自定义主键编号
 * @author feizns
 * @since 2022/10/8
 */
@Getter
@Setter
@ToString
@Accessors(chain = true)
@MappedSuperclass
@JsonPropertyOrder(StringIdPojo.keyColumnName)
public abstract class StringIdPojo<T extends StringIdPojo<T>> extends Pojo<T, String> {

    /**
     * （主键）编号
     */
    @Id
    @Comment("自定义主键编号")
    @TableId(type = IdType.INPUT)
    @Column(name = keyColumnName, nullable = false)
    protected String id;

}
